<template>
	<view>
		<view class="tips1">
			请填写个人信息
		</view>
		<view class="line1">
			<view class="label">姓名</view>
			<view class="value">
				<input 
					placeholder="请填写您的姓名"
					v-model="form_data.name"
					placeholder-class="placeholder_class"/>
			</view>
		</view>
		<view class="line1">
			<view class="label">手机号</view>
			<view class="value">
				<input 
					placeholder="请填写您的手机号"
					v-model="form_data.tel"
					placeholder-class="placeholder_class"/>
			</view>
		</view>
		<view class="line1">
			<view class="label">身份证号</view>
			<view class="value">
				<input 
					placeholder="请填写您的身份证号"
					v-model="form_data.idcard"
					placeholder-class="placeholder_class"/>
			</view>
		</view>
		<view class="line1">
			<view class="label">毕业学校</view>
			<view class="value">
				<input 
					placeholder="请填写您的毕业学校"
					v-model="form_data.school"
					placeholder-class="placeholder_class"/>
			</view>
		</view>
		<view class="line1">
			<view class="label">专业</view>
			<view class="value">
				<input 
					placeholder="请填写您的专业"
					v-model="form_data.zhuanye"
					placeholder-class="placeholder_class"/>
			</view>
		</view>
		<view class="line1">
			<view class="label">医师资格证</view>
			<view class="image_con">
				<u-upload 
					ref="yishizigezheng"
					max-count="1"
					:action="update_url">
				</u-upload>
			</view>
		</view>
		<view class="line1">
			<view class="label">执业证</view>
			<view class="image_con">
				<u-upload 
					ref="zhiyezheng"
					max-count="1"
					:action="update_url">
				</u-upload>
			</view>
		</view>
		<view class="line1">
			<view class="label">职称证</view>
			<view class="image_con">
				<u-upload 
					ref="zhichengzheng"
					max-count="1"
					:action="update_url">
				</u-upload>
			</view>
		</view>
		<view class="line1">
			<view class="label">主治项目</view>
			<view class="value">
				<input 
					placeholder="请填写您的主治项目"
					v-model="form_data.zhuzhixiangmu"
					placeholder-class="placeholder_class"/>
			</view>
		</view>
		<view class="line1">
			<view class="label">注册地址</view>
			<view class="value">
				<input
					placeholder="请填写您的注册地址"
					v-model="form_data.address"
					placeholder-class="placeholder_class"/>
			</view>
		</view>
		<view class="line1">
			<view class="label">多点执业地址</view>
			<view class="value">
				<input
					placeholder="请填写您的挂号费"
					v-model="form_data.more_address"
					placeholder-class="placeholder_class"/>
			</view>
		</view>
		<view class="line1">
			<view class="btn" @click="save_user_info">保存信息</view>
		</view>
	</view>
</template>

<script>
	import { save_user_info } from '@/util/api/api.js';
		
	export default {
		data() {
			return {
				update_url:getApp().globalData.domain+'/index.php/html5/index/uploadImg',
				form_data:{
					"name": "",
					"tel": "",
					"idcard": "",
					"school": "",
					"zhuanye": "",
					"yishizigezheng": "",
					"zhiyezheng": "",
					"zhichengzheng": "",
					"zhuzhixiangmu": "",
					"address": "",
					"more_address": "",
					"openid": ""
				}
			}
		},
		onLoad() {

		},
		methods: {
			async save_user_info(){
				this.form_data.yishizigezheng = this.get_url('yishizigezheng')
				this.form_data.zhiyezheng = this.get_url('zhiyezheng')
				// this.form_data.zhichengzheng = this.get_url('zhichengzheng')
				
				let res = await save_user_info(this.form)
				console.log(res);
			},
			get_url(key){
				console.log(this.$refs[key].lists[0].response.data.url);
				return this.$refs[key].lists[0].response.data.url
			},
		}
	}
</script>

<style>
.tips1{
	height: 104rpx;
	font-size: 36rpx;
	font-family: PingFang SC;
	font-weight: 800;
	color: #333333;
	line-height: 44rpx;
	padding: 30rpx;
	background: #F5F5F5;
}

.line1{
	padding: 30rpx;
}
.label{
	height: 30;
	font-size: 30rpx;
	font-family: PingFang SC;
	font-weight: bold;
	color: #666666;
	line-height: 30rpx;
}
.value input{
	width: 100%;
	height: 77rpx;
	font-size: 32rpx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #333333;
	line-height: 77rpx;
	border-bottom: 2rpx solid #f5f5f5;
}

.placeholder_class{
	height: 77rpx;
	font-size: 32rpx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #B3B3B3;
	line-height: 77rpx;
	border-bottom: 2rpx solid #f5f5f5;
}
.btn{
	width: 690rpx;
	height: 88rpx;
	background: #15BBA2;
	border-radius: 44rpx;
	line-height: 88rpx;
	font-size: 36rpx;
	font-family: PingFang SC;
	font-weight: bold;
	color: #FFFFFF;
	text-align: center;
}
.image_con{
	margin-top: 10px;
}
</style>